package mlz.c_private;

public class StudentDemo01 {
    public static void main(String[] args) {
        Student stu1 = new Student();
//        System.out.println(stu1.age);
//        System.out.println(stu1.name);
        stu1.eat();

        //通过调用方法然后获取 / 修改对应的成员变量
        int age = stu1.getAge();
        System.out.println(age);//0
        String name = stu1.getName();
        System.out.println(name);//null

        //设置私有成员变量
        stu1.setName("lucy");
        stu1.setAge(30);
        System.out.println(stu1.getAge());//30
        System.out.println(stu1.getName());//lucy

    }
}
